<?php
/**
 * 上传控制器
 * Date: 2025/09/10
 */

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\BaseController;
use App\Services\Admin\UploadService;
use Illuminate\Http\Request;

class UploadController extends BaseController
{
    /**
     * 图片上传
     * @date 2025/09/10
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function image(Request $request)
    {
        // 图片校验
        $file = $request->file('file');
        if (empty($file)) {
            return $this->failed('图片不能为空');
        }

        return (new UploadService())->image($file);
    }
}
